﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class GetBarcode : System.Web.UI.Page
{

    private string boxNo = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {

        boxNo = Request.QueryString["boxno"];
        CreateImage(boxNo);
    }

    private void CreateImage(string checkCode)
    {

        BarCode barcode = new BarCode();
        System.Drawing.Bitmap image = barcode.CreateBarCode(boxNo);
        

        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        Response.Cache.SetNoStore();//history back 不重复
        Response.ClearContent();
        Response.ContentType = "image/png";
        Response.BinaryWrite(ms.ToArray());
        ms.Close();
        ms.Dispose();
       
        image.Dispose();
    }
}